﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace LSBLL
{
    public class UpFileBLL
    {
        public static bool UpFile(string savePath, byte[] fs, Action callback = null)
        {
            try
            {
                if (String.IsNullOrEmpty(savePath) || fs == null) return false;
                using (var m = new MemoryStream(fs))
                {
                    using (var f = new FileStream(savePath, FileMode.Create))
                    {
                        m.WriteTo(f);
                        if (callback != null) callback();
                    }
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
